﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Users.aspx.cs" Inherits="Users" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
  
  <asp:Panel ID="systemOrClinetUsersPanel1" runat="server" Visible="False">
        <table>
            <tr>
                <td>
                    <asp:Button ID="systemOrClientiShowSystemUsersButton" runat="server" 
                        Text="Baza de date System Users" 
                        onclick="systemOrClientiShowSystemUsersButton_Click" /> 
                </td>                
                <td>                   
                    <asp:Button ID="systemOrClientiShowSolicitantiButton" runat="server" 
                        Text="Baza de date Solicitanti" 
                        onclick="systemOrClientiShowSolicitantiButton_Click" />   
                </td>
            </tr>
        </table>
    </asp:Panel>

  <asp:Panel ID="solicitantiUsersAdminPanel" runat="server" Visible="False">
        &nbsp;
       
        <br />
        <asp:GridView ID="solicitantiUsersGridView" runat="server" 
            CellPadding="4" 
            EnableModelValidation="True" 
            HorizontalAlign="Justify" 
            AutoGenerateColumns="False" 
            CssClass="mGrid"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt"
            Width="100%" 
            AllowPaging="True" 
            onpageindexchanging="solicitantiUsersGridView_PageIndexChanging"             
            onrowediting="solicitantiUsersGridView_RowEditing" 
            PageSize="30" 
            >
            
            <Columns>
                <asp:BoundField DataField="ID"              HeaderText="User ID"                HtmlEncode="False"   HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />  
                <asp:BoundField DataField="ParentID"              HeaderText="Parent ID"                HtmlEncode="False"   HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />  
                <asp:BoundField DataField="Nume"          HeaderText="Nume"             HtmlEncode="False" />
                <asp:BoundField DataField="Prenume"          HeaderText="Prenume"             HtmlEncode="False" />
                <asp:BoundField DataField="NumeAnterior"               HeaderText="Nume Anterior"                  HtmlEncode="False"/>  
                <asp:BoundField DataField="Pasaport"            HeaderText="Pasaport"              HtmlEncode="False"/>

                <asp:TemplateField HeaderText="Data Nastere">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# ((Eval("DataNastere") != null && Eval("DataNastere") is DateTime) ?  ((DateTime)Eval("DataNastere")).ToShortDateString() : "") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField DataField="LocNastere"            HeaderText="Localitatea Nasterii"         HtmlEncode="False" />
                <asp:BoundField DataField="stringTaraNastere" HeaderText="Tara Nastere"       HtmlEncode="False"  />
                <asp:BoundField DataField="stringSex"      HeaderText="Sex"   HtmlEncode="False"/>
                <asp:BoundField DataField="Cetatenie"  HeaderText="Cetatenie"          HtmlEncode="False" />
                <asp:BoundField DataField="NumeTATA"        HeaderText="Nume TATA"     HtmlEncode="False" />                
                <asp:BoundField DataField="NumeMAMA"               HeaderText="Nume MAMA"                  HtmlEncode="False"  />
                <asp:BoundField DataField="Domiciliu"               HeaderText="Domiciliu"                  HtmlEncode="False"  />
                <asp:BoundField DataField="stringTaraDomiciliu"               HeaderText="Tara Domiciliu"                  HtmlEncode="False"  />
                <asp:BoundField DataField="Telefon"               HeaderText="Telefon"                  HtmlEncode="False"  />
                <asp:BoundField DataField="Email"               HeaderText="Email"                  HtmlEncode="False"  />
                <asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Reset Password" ControlStyle-CssClass="button" />
            </Columns>           
        </asp:GridView>        

    </asp:Panel>
    
  <asp:Panel ID="resetSolicitantiPasswordPanel" runat="server" Visible="False">
        <table>
            <tr>
                <td>
                    <asp:Label ID="Label36" runat="server" Text="User ID: "></asp:Label>
                </td>
                <td>
                    <asp:Label ID="resetSolicitantiPasswordUserIDLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label102" runat="server" Text="Login: "></asp:Label>
                </td>
                <td>
                    <asp:Label ID="resetSolicitantiPasswordLoghinLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label104" runat="server" Text="Password: "></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="resetSolicitantiPasswordNewPasswordTextBox" TextMode="Password" runat="server" Width="161px" ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label105" runat="server" Text="Repeat password: "></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="resetSolicitantiPasswordRepeatPasswordTextBox" TextMode="Password" runat="server" Width="161px"></asp:TextBox>
                    <asp:CompareValidator id="CompareValidator1" 
                      runat="server"
                      ControlToCompare="resetSolicitantiPasswordNewPasswordTextBox"
                      ControlToValidate="resetSolicitantiPasswordRepeatPasswordTextBox"
                      ErrorMessage="Your passwords do not match up!"
                      Display="Dynamic" />
                </td>
            </tr>
        </table>

        <asp:Button ID="resetSolicitantiPasswordSaveButton" runat="server" Text="Save" 
            CssClass="button" onclick="resetSolicitantiPasswordSaveButton_Click" />

            &nbsp;&nbsp;  

        <asp:Label ID="Label106" runat="server" Text="OR" ></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="resetSolicitantiPasswordCancelButton" runat="server" Text="Cancel" 
            CssClass="button" onclick="resetSolicitantiPasswordCancelButton_Click"  />
    </asp:Panel>
    
  <asp:Panel ID="systemUsersAdminPanel" runat="server" Visible="False">
        &nbsp;
        <asp:Button ID="addSystemUserButton" runat="server" Text="New user"  Width="120px" 
            onclick="addSystemUserButton_Click" CssClass="button" />
        <br />
         <asp:DropDownList ID="systemUsersConsulatDDL" runat="server" 
            AutoPostBack="true" Height="25px" Width="430px" 
            onselectedindexchanged="systemUsersConsulatDDL_SelectedIndexChanged" >   </asp:DropDownList>
        <br />
        <asp:Label ID="usersGridPageTopLabel" runat="server" ></asp:Label>

        <asp:GridView ID="usersGridView" runat="server" 
            CellPadding="4" 
            EnableModelValidation="True" 
            HorizontalAlign="Justify" 
            AutoGenerateColumns="False" 
            CssClass="mGrid"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt"
            Width="100%" 
            AllowPaging="True" 
            onpageindexchanging="usersGridView_PageIndexChanging"             
            onrowediting="usersEditButton_Click" 
            PageSize="100" onrowupdating="usersGridView_RowUpdating">
            
            <Columns>

                <asp:BoundField DataField="userid"              HeaderText="User ID"                HtmlEncode="False"   HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn"  />  
                <asp:BoundField DataField="idConsulat"          HeaderText="ID Consulat"             HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn"  />
                <asp:BoundField DataField="Consulatul"          HeaderText="Consulatul"             HtmlEncode="False" HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />
                <asp:BoundField DataField="login"               HeaderText="Login"                  HtmlEncode="False"/>  
                <asp:BoundField DataField="Nume"           HeaderText="First name"             HtmlEncode="False"/>
                <asp:BoundField DataField="Prenume"            HeaderText="Last name"              HtmlEncode="False"/>
                <asp:BoundField DataField="role_type_name"      HeaderText="Role type"              HtmlEncode="False"/>
                <asp:BoundField DataField="roletype"            HeaderText="Role type code"         HtmlEncode="False"   HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />
                <asp:BoundField DataField="password_status_name" HeaderText="Password status"       HtmlEncode="False"  />
                <asp:BoundField DataField="passwordstatus"      HeaderText="Password status code"   HtmlEncode="False"   HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />
                <asp:BoundField DataField="record_status_name"  HeaderText="Record status"          HtmlEncode="False" />
                <asp:BoundField DataField="recordstatus"        HeaderText="Record status code"     HtmlEncode="False"   HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />                
                <asp:BoundField DataField="email"               HeaderText="Email"                  HtmlEncode="False"  />
                <asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" ControlStyle-CssClass="button" />
                <asp:ButtonField ButtonType="Button" CommandName="Update" Text="Reset Password" ControlStyle-CssClass="button" />

            </Columns>           
        </asp:GridView>

    </asp:Panel>
    
  <asp:Panel ID="addSystemUserPanel" runat="server" Visible="False">
    <table>
        <tr>
            <td>
                <asp:Label ID="Label20" runat="server" Text="Consulatul : " ></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="addSystemUserConsulatSelector" runat="server" Height="24px" Width="430px" > </asp:DropDownList>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label14" runat="server" Text="Login: " ></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="addSystemUserloginTextBox" runat="server" Width="161px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label7" runat="server" Text="First name: "></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="addSystemUserfirstnameTextBox" runat="server" Width="161px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label8" runat="server" Text="Last name: "></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="addSystemUserlastNameTextBox" runat="server" Width="161px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label15" runat="server" Text="Password: "></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="addSystemUserpasswordTextBox" TextMode="Password" runat="server" Width="161px" ></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label16" runat="server" Text="Repeat password: "></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="addSystemUserrepeatPasswordTextBox" TextMode="Password" runat="server" Width="161px" ></asp:TextBox>
                <asp:CompareValidator id="CompareValidator2" 
                      runat="server"
                      ControlToCompare="addSystemUserpasswordTextBox"
                      ControlToValidate="addSystemUserrepeatPasswordTextBox"
                      ErrorMessage="Your passwords do not match up!"
                      Display="Dynamic" />
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label17" runat="server" Text="Role type: "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="addSystemUserRoleTypeSelector" runat="server" Height="24px" Width="159px" >      </asp:DropDownList>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label18" runat="server" Text="Password status: " ></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="addSystemUserPasswordStatusSelector" runat="server" Height="24px" Width="159px" > </asp:DropDownList>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label19" runat="server" Text="Record status: "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="addSystemUserRecordStatusSelector" runat="server" Height="24px"  Width="159px">
                    <asp:ListItem Value="0">Disabled</asp:ListItem>
                    <asp:ListItem Value="1">Active</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>     
       
        <tr>
            <td>
                <asp:Label ID="Label22" runat="server" Text="Email: " ></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="addSystemUserEmailTextBox" runat="server" Width="161px" ></asp:TextBox>
            </td>
        </tr>

    </table>
                    
    <asp:Button ID="addSystemUserSaveButton" runat="server" Text="Save" 
            CssClass="button" onclick="addSystemUserSaveButton_Click" />

    &nbsp;&nbsp;  

    <asp:Label ID="Label9" runat="server" Text="OR" ></asp:Label>

    &nbsp;&nbsp;

    <asp:Button ID="addSystemUserCancelButton" runat="server" Text="Cancel" 
            CssClass="button" onclick="addSystemUserCancelButton_Click" />

</asp:Panel>

  <asp:Panel ID="editSystemUserPanel" runat="server" Visible="False">
    <asp:HiddenField ID="editSystemUserIDHiddenField" runat="server" />
    <table>
        <tr>
            
            <td>
                <asp:Label ID="Label10" runat="server" Text="Consulatul : " ></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="editSystemUserConsulatSelector" runat="server" Height="24px" Width="430px" > </asp:DropDownList>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label11" runat="server" Text="Login: " ></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="editSystemUserLoginTextBox" runat="server" Width="161px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label12" runat="server" Text="First name: "></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="editSystemUserFirstNameTextBox" runat="server" Width="161px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label13" runat="server" Text="Last name: "></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="editSystemUserLastNameTextBox" runat="server" Width="161px"></asp:TextBox>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label37" runat="server" Text="Role type: "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="editSystemUserRoleTypeSelector" runat="server" Height="24px" Width="159px" >      </asp:DropDownList>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label40" runat="server" Text="Password status: " ></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="editSystemUserPasswordStatusSelector" runat="server" Height="24px" Width="159px" > </asp:DropDownList>
            </td>
        </tr>

        <tr>
            <td>
                <asp:Label ID="Label41" runat="server" Text="Record status: "></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="editSystemUserRecordStatusSelector" runat="server" Height="24px"  Width="159px">
                    <asp:ListItem Value="0">Disabled</asp:ListItem>
                    <asp:ListItem Value="1">Active</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>     
       
        <tr>
            <td>
                <asp:Label ID="Label42" runat="server" Text="Email: " ></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="editSystemUserEmailTextBox" runat="server" Width="161px" ></asp:TextBox>
            </td>
        </tr>

    </table>
                    
    <asp:Button ID="editSystemUserSaveButton" runat="server" Text="Save" 
            CssClass="button" onclick="editSystemUserSaveButton_Click" />

    &nbsp;&nbsp;  

    <asp:Label ID="Label43" runat="server" Text="OR" ></asp:Label>

    &nbsp;&nbsp;

    <asp:Button ID="editSystemUserCancelButton" runat="server" Text="Cancel" 
            CssClass="button" onclick="editSystemUserCancelButton_Click" />

</asp:Panel>

  <asp:Panel ID="editSystemUserPasswordPanel" runat="server" Visible="False">
        <table>
            <tr>
                <td>
                    <asp:Label ID="Label45" runat="server" Text="User ID: "></asp:Label>
                </td>
                <td>
                    <asp:Label ID="editUserPasswordUserIdLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label52" runat="server" Text="Login: "></asp:Label>
                </td>
                <td>
                    <asp:Label ID="editUserPasswordLoginLabel" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label53" runat="server" Text="Password: "></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editUserPasswordPasswordTextBox" TextMode="Password" runat="server" Width="161px" ></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label54" runat="server" Text="Repeat password: "></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editUserPasswordRepeatPasswordTextBox" TextMode="Password" runat="server" Width="161px"></asp:TextBox>
                    <asp:CompareValidator id="comparePasswords" 
                      runat="server"
                      ControlToCompare="editUserPasswordRepeatPasswordTextBox"
                      ControlToValidate="editUserPasswordPasswordTextBox"
                      ErrorMessage="Your passwords do not match up!"
                      Display="Dynamic" />
                </td>
            </tr>
        </table>

        <asp:Button ID="editUserPasswordSaveButton" runat="server" Text="Save" 
            CssClass="button" onclick="editUserPasswordSaveButton_Click" />

            &nbsp;&nbsp;  

        <asp:Label ID="Label59" runat="server" Text="OR" ></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="editUserPasswordCancelButton" runat="server" Text="Cancel" 
            CssClass="button" onclick="editUserPasswordCancelButton_Click"  />
    </asp:Panel>

</asp:Content>

